home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / Development Kits / MPW etc. / MPW-GM / Interfaces&Libraries / Interfaces / CIncludes / Menus.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-17  |  20.9 KB  |  675 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Menus.h
  3.  
  4.      Contains:    Menu Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __MENUS__
  19. #define __MENUS__
  20.  
  21. #ifndef __APPLEEVENTS__
  22. #include <AppleEvents.h>
  23. #endif
  24. #ifndef __CONDITIONALMACROS__
  25. #include <ConditionalMacros.h>
  26. #endif
  27. #ifndef __EVENTS__
  28. #include <Events.h>
  29. #endif
  30. #ifndef __PROCESSES__
  31. #include <Processes.h>
  32. #endif
  33. #ifndef __TEXTCOMMON__
  34. #include <TextCommon.h>
  35. #endif
  36. #ifndef __MACTYPES__
  37. #include <MacTypes.h>
  38. #endif
  39. #ifndef __QUICKDRAW__
  40. #include <Quickdraw.h>
  41. #endif
  42.  
  43.  
  44.  
  45. #if PRAGMA_ONCE
  46. #pragma once
  47. #endif
  48.  
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif
  52.  
  53. #if PRAGMA_IMPORT
  54. #pragma import on
  55. #endif
  56.  
  57. #if PRAGMA_STRUCT_ALIGN
  58.     #pragma options align=mac68k
  59. #elif PRAGMA_STRUCT_PACKPUSH
  60.     #pragma pack(push, 2)
  61. #elif PRAGMA_STRUCT_PACK
  62.     #pragma pack(2)
  63. #endif
  64.  
  65. /*——————————————————————————————————————————————————————————————————————————————————————*/
  66. /*    • Menu Types (for Appearance 1.0 and later)                                            */
  67. /*——————————————————————————————————————————————————————————————————————————————————————*/
  68.  
  69. enum {
  70.     kMenuStdMenuProc            = 63,
  71.     kMenuStdMenuBarProc            = 63
  72. };
  73.  
  74.  
  75. enum {
  76.     kMenuNoModifiers            = 0,                            /* Mask for no modifiers*/
  77.     kMenuShiftModifier            = (1 << 0),                        /* Mask for shift key modifier*/
  78.     kMenuOptionModifier            = (1 << 1),                        /* Mask for option key modifier*/
  79.     kMenuControlModifier        = (1 << 2),                        /* Mask for control key modifier*/
  80.     kMenuNoCommandModifier        = (1 << 3)                        /* Mask for no command key modifier*/
  81. };
  82.  
  83.  
  84. enum {
  85.     kMenuNoIcon                    = 0,                            /* No icon*/
  86.     kMenuIconType                = 1,                            /* Type for ICON*/
  87.     kMenuShrinkIconType            = 2,                            /* Type for ICON plotted 16 x 16*/
  88.     kMenuSmallIconType            = 3,                            /* Type for SICN*/
  89.     kMenuColorIconType            = 4,                            /* Type for cicn*/
  90.     kMenuIconSuiteType            = 5,                            /* Type for Icon Suite*/
  91.     kMenuIconRefType            = 6                                /* Type for Icon Ref*/
  92. };
  93.  
  94. /* —— end of Appearance 1.0 types*/
  95.  
  96.  
  97. enum {
  98.     noMark                        = 0                                /*mark symbol for MarkItem*/
  99. };
  100.  
  101.  
  102. enum {
  103.                                                                 /* menu defProc messages */
  104.     kMenuDrawMsg                = 0,
  105.     kMenuChooseMsg                = 1,
  106.     kMenuSizeMsg                = 2,
  107.     kMenuDrawItemMsg            = 4,
  108.     kMenuCalcItemMsg            = 5,
  109.     kMenuThemeSavvyMsg            = 7,                            /* is your MDEF theme-savvy?  If so, return hex 7473 in the whichItem parameter*/
  110.     mDrawMsg                    = 0,
  111.     mChooseMsg                    = 1,
  112.     mSizeMsg                    = 2,
  113.     mDrawItemMsg                = 4,
  114.     mCalcItemMsg                = 5
  115. };
  116.  
  117.  
  118. enum {
  119.     kThemeSavvyMenuResponse        = 0x7473
  120. };
  121.  
  122.  
  123. enum {
  124.     textMenuProc                = 0,
  125.     hMenuCmd                    = 27,                            /*itemCmd == 0x001B ==> hierarchical menu*/
  126.     hierMenu                    = -1,                            /*a hierarchical menu - for InsertMenu call*/
  127.     mPopUpMsg                    = 3,                            /*menu defProc messages - place yourself*/
  128.     mctAllItems                    = -98,                            /*search for all Items for the given ID*/
  129.     mctLastIDIndic                = -99                            /*last color table entry has this in ID field*/
  130. };
  131.  
  132.  
  133.  
  134. struct MenuInfo {
  135.     short                             menuID;
  136.     short                             menuWidth;
  137.     short                             menuHeight;
  138.     Handle                             menuProc;
  139.     long                             enableFlags;
  140.     Str255                             menuData;
  141. };
  142. typedef struct MenuInfo                    MenuInfo;
  143.  
  144. typedef MenuInfo *                        MenuPtr;
  145. typedef MenuPtr *                        MenuHandle;
  146. /* MenuRef is obsolete.  Use MenuHandle. */
  147. typedef MenuHandle                         MenuRef;
  148.  
  149. struct MCEntry {
  150.     short                             mctID;                        /*menu ID.  ID = 0 is the menu bar*/
  151.     short                             mctItem;                    /*menu Item. Item = 0 is a title*/
  152.     RGBColor                         mctRGB1;                    /*usage depends on ID and Item*/
  153.     RGBColor                         mctRGB2;                    /*usage depends on ID and Item*/
  154.     RGBColor                         mctRGB3;                    /*usage depends on ID and Item*/
  155.     RGBColor                         mctRGB4;                    /*usage depends on ID and Item*/
  156.     short                             mctReserved;                /*reserved for internal use*/
  157. };
  158. typedef struct MCEntry                    MCEntry;
  159. typedef MCEntry *                        MCEntryPtr;
  160.  
  161. typedef MCEntry                         MCTable[1];
  162. typedef MCEntry *                        MCTablePtr;
  163. typedef MCTablePtr *                    MCTableHandle;
  164.  
  165. struct MenuCRsrc {
  166.     short                             numEntries;                    /*number of entries*/
  167.     MCTable                         mcEntryRecs;                /*ARRAY [1..numEntries] of MCEntry*/
  168. };
  169. typedef struct MenuCRsrc                MenuCRsrc;
  170. typedef MenuCRsrc *                        MenuCRsrcPtr;
  171. typedef MenuCRsrcPtr *                    MenuCRsrcHandle;
  172. #if TARGET_OS_WIN32
  173. /* QuickTime 3.0 */
  174.  
  175. struct MenuAccessKeyRec {
  176.     short                             count;
  177.     long                             flags;
  178.     unsigned char                     keys[1];
  179. };
  180. typedef struct MenuAccessKeyRec            MenuAccessKeyRec;
  181.  
  182. typedef MenuAccessKeyRec *                MenuAccessKeyPtr;
  183. typedef MenuAccessKeyPtr *                MenuAccessKeyHandle;
  184. #endif  /* TARGET_OS_WIN32 */
  185.  
  186. typedef CALLBACK_API( void , MenuDefProcPtr )(short message, MenuHandle theMenu, Rect *menuRect, Point hitPt, short *whichItem);
  187. typedef CALLBACK_API( long , MenuBarDefProcPtr )(short selector, short message, short parameter1, long parameter2);
  188. typedef CALLBACK_API( void , MenuHookProcPtr )(void );
  189. typedef CALLBACK_API( short , MBarHookProcPtr )(Rect *menuRect);
  190. /*
  191.     WARNING: MBarHookProcPtr uses register based parameters under classic 68k
  192.              and cannot be written in a high-level language without 
  193.              the help of mixed mode or assembly glue.
  194. */
  195. typedef STACK_UPP_TYPE(MenuDefProcPtr)                             MenuDefUPP;
  196. typedef STACK_UPP_TYPE(MenuBarDefProcPtr)                         MenuBarDefUPP;
  197. typedef STACK_UPP_TYPE(MenuHookProcPtr)                         MenuHookUPP;
  198. typedef REGISTER_UPP_TYPE(MBarHookProcPtr)                         MBarHookUPP;
  199. enum { uppMenuDefProcInfo = 0x0000FF80 };                         /* pascal no_return_value Func(2_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  200. enum { uppMenuBarDefProcInfo = 0x00003AB0 };                     /* pascal 4_bytes Func(2_bytes, 2_bytes, 2_bytes, 4_bytes) */
  201. enum { uppMenuHookProcInfo = 0x00000000 };                         /* pascal no_return_value Func() */
  202. enum { uppMBarHookProcInfo = 0x000000CF };                         /* SPECIAL_CASE_PROCINFO(12) */
  203. #define NewMenuDefProc(userRoutine)                             (MenuDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuDefProcInfo, GetCurrentArchitecture())
  204. #define NewMenuBarDefProc(userRoutine)                             (MenuBarDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuBarDefProcInfo, GetCurrentArchitecture())
  205. #define NewMenuHookProc(userRoutine)                             (MenuHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuHookProcInfo, GetCurrentArchitecture())
  206. #define NewMBarHookProc(userRoutine)                             (MBarHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMBarHookProcInfo, GetCurrentArchitecture())
  207. #define CallMenuDefProc(userRoutine, message, theMenu, menuRect, hitPt, whichItem)  CALL_FIVE_PARAMETER_UPP((userRoutine), uppMenuDefProcInfo, (message), (theMenu), (menuRect), (hitPt), (whichItem))
  208. #define CallMenuBarDefProc(userRoutine, selector, message, parameter1, parameter2)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppMenuBarDefProcInfo, (selector), (message), (parameter1), (parameter2))
  209. #define CallMenuHookProc(userRoutine)                             CALL_ZERO_PARAMETER_UPP((userRoutine), uppMenuHookProcInfo)
  210. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  211.     /* CallMBarHookProc can't be called from classic 68k without glue code */
  212. #else
  213.     #define CallMBarHookProc(userRoutine, menuRect)             CALL_ONE_PARAMETER_UPP((userRoutine), uppMBarHookProcInfo, (menuRect))
  214. #endif
  215.  
  216. EXTERN_API( short )
  217. GetMBarHeight                    (void)                                                        TWOWORDINLINE(0x3EB8, 0x0BAA);
  218.  
  219. EXTERN_API( void )
  220. InitMenus                        (void)                                                        ONEWORDINLINE(0xA930);
  221.  
  222. EXTERN_API( MenuHandle )
  223. NewMenu                            (short                     menuID,
  224.                                  ConstStr255Param         menuTitle)                            ONEWORDINLINE(0xA931);
  225.  
  226. #if TARGET_OS_MAC
  227.     #define MacGetMenu GetMenu
  228. #endif
  229. EXTERN_API( MenuHandle )
  230. MacGetMenu                        (short                     resourceID)                            ONEWORDINLINE(0xA9BF);
  231.  
  232. EXTERN_API( void )
  233. DisposeMenu                        (MenuHandle             theMenu)                            ONEWORDINLINE(0xA932);
  234.  
  235. #if TARGET_OS_MAC
  236.     #define MacAppendMenu AppendMenu
  237. #endif
  238. EXTERN_API( void )
  239. MacAppendMenu                    (MenuHandle             menu,
  240.                                  ConstStr255Param         data)                                ONEWORDINLINE(0xA933);
  241.  
  242. EXTERN_API( void )
  243. InsertResMenu                    (MenuHandle             theMenu,
  244.                                  ResType                 theType,
  245.                                  short                     afterItem)                            ONEWORDINLINE(0xA951);
  246.  
  247. #if TARGET_OS_MAC
  248.     #define MacInsertMenu InsertMenu
  249. #endif
  250. EXTERN_API( void )
  251. MacInsertMenu                    (MenuHandle             theMenu,
  252.                                  short                     beforeID)                            ONEWORDINLINE(0xA935);
  253.  
  254. #if TARGET_OS_MAC
  255.     #define MacDeleteMenu DeleteMenu
  256. #endif
  257. EXTERN_API( void )
  258. MacDeleteMenu                    (short                     menuID)                                ONEWORDINLINE(0xA936);
  259.  
  260. EXTERN_API( void )
  261. AppendResMenu                    (MenuHandle             theMenu,
  262.                                  ResType                 theType)                            ONEWORDINLINE(0xA94D);
  263.  
  264. #if TARGET_OS_MAC
  265.     #define MacInsertMenuItem InsertMenuItem
  266. #endif
  267. EXTERN_API( void )
  268. MacInsertMenuItem                (MenuHandle             theMenu,
  269.                                  ConstStr255Param         itemString,
  270.                                  short                     afterItem)                            ONEWORDINLINE(0xA826);
  271.  
  272. EXTERN_API( void )
  273. DeleteMenuItem                    (MenuHandle             theMenu,
  274.                                  short                     item)                                ONEWORDINLINE(0xA952);
  275.  
  276. EXTERN_API( long )
  277. MenuKey                            (CharParameter             ch)                                    ONEWORDINLINE(0xA93E);
  278.  
  279. EXTERN_API( void )
  280. HiliteMenu                        (short                     menuID)                                ONEWORDINLINE(0xA938);
  281.  
  282. EXTERN_API( void )
  283. SetMenuItemText                    (MenuHandle             theMenu,
  284.                                  short                     item,
  285.                                  ConstStr255Param         itemString)                            ONEWORDINLINE(0xA947);
  286.  
  287. EXTERN_API( void )
  288. GetMenuItemText                    (MenuHandle             theMenu,
  289.                                  short                     item,
  290.                                  Str255                 itemString)                            ONEWORDINLINE(0xA946);
  291.  
  292. EXTERN_API( void )
  293. SetItemMark                        (MenuHandle             theMenu,
  294.                                  short                     item,
  295.                                  CharParameter             markChar)                            ONEWORDINLINE(0xA944);
  296.  
  297. EXTERN_API( void )
  298. GetItemMark                        (MenuHandle             theMenu,
  299.                                  short                     item,
  300.                                  CharParameter *        markChar)                            ONEWORDINLINE(0xA943);
  301.  
  302. EXTERN_API( void )
  303. SetItemCmd                        (MenuHandle             theMenu,
  304.                                  short                     item,
  305.                                  CharParameter             cmdChar)                            ONEWORDINLINE(0xA84F);
  306.  
  307. EXTERN_API( void )
  308. GetItemCmd                        (MenuHandle             theMenu,
  309.                                  short                     item,
  310.                                  CharParameter *        cmdChar)                            ONEWORDINLINE(0xA84E);
  311.  
  312. EXTERN_API( void )
  313. SetItemIcon                        (MenuHandle             theMenu,
  314.                                  short                     item,
  315.                                  short                     iconIndex)                            ONEWORDINLINE(0xA940);
  316.  
  317. EXTERN_API( void )
  318. GetItemIcon                        (MenuHandle             theMenu,
  319.                                  short                     item,
  320.                                  short *                iconIndex)                            ONEWORDINLINE(0xA93F);
  321.  
  322. EXTERN_API( void )
  323. SetItemStyle                    (MenuHandle             theMenu,
  324.                                  short                     item,
  325.                                  StyleParameter         chStyle)                            ONEWORDINLINE(0xA942);
  326.  
  327. EXTERN_API( void )
  328. GetItemStyle                    (MenuHandle             theMenu,
  329.                                  short                     item,
  330.                                  Style *                chStyle);
  331.  
  332. EXTERN_API( MenuHandle )
  333. GetMenuHandle                    (short                     menuID)                                ONEWORDINLINE(0xA949);
  334.  
  335. EXTERN_API( void )
  336. CalcMenuSize                    (MenuHandle             theMenu)                            ONEWORDINLINE(0xA948);
  337.  
  338. EXTERN_API( void )
  339. DisableItem                        (MenuHandle             theMenu,
  340.                                  short                     item)                                ONEWORDINLINE(0xA93A);
  341.  
  342. EXTERN_API( void )
  343. EnableItem                        (MenuHandle             theMenu,
  344.                                  short                     item)                                ONEWORDINLINE(0xA939);
  345.  
  346. EXTERN_API( void )
  347. FlashMenuBar                    (short                     menuID)                                ONEWORDINLINE(0xA94C);
  348.  
  349. EXTERN_API( long )
  350. PopUpMenuSelect                    (MenuHandle             menu,
  351.                                  short                     top,
  352.                                  short                     left,
  353.                                  short                     popUpItem)                            ONEWORDINLINE(0xA80B);
  354.  
  355. EXTERN_API( long )
  356. MenuChoice                        (void)                                                        ONEWORDINLINE(0xAA66);
  357.  
  358. EXTERN_API( void )
  359. DeleteMCEntries                    (short                     menuID,
  360.                                  short                     menuItem)                            ONEWORDINLINE(0xAA60);
  361.  
  362. EXTERN_API( MCTableHandle )
  363. GetMCInfo                        (void)                                                        ONEWORDINLINE(0xAA61);
  364.  
  365. EXTERN_API( void )
  366. SetMCInfo                        (MCTableHandle             menuCTbl)                            ONEWORDINLINE(0xAA62);
  367.  
  368. EXTERN_API( void )
  369. DisposeMCInfo                    (MCTableHandle             menuCTbl)                            ONEWORDINLINE(0xAA63);
  370.  
  371. EXTERN_API( MCEntryPtr )
  372. GetMCEntry                        (short                     menuID,
  373.                                  short                     menuItem)                            ONEWORDINLINE(0xAA64);
  374.  
  375. EXTERN_API( void )
  376. SetMCEntries                    (short                     numEntries,
  377.                                  MCTablePtr             menuCEntries)                        ONEWORDINLINE(0xAA65);
  378.  
  379. #if TARGET_OS_MAC
  380.     #define MacDrawMenuBar DrawMenuBar
  381. #endif
  382. EXTERN_API( void )
  383. MacDrawMenuBar                    (void)                                                        ONEWORDINLINE(0xA937);
  384.  
  385. EXTERN_API( void )
  386. InvalMenuBar                    (void)                                                        ONEWORDINLINE(0xA81D);
  387.  
  388. EXTERN_API( void )
  389. InitProcMenu                    (short                     resID)                                ONEWORDINLINE(0xA808);
  390.  
  391. EXTERN_API( Handle )
  392. GetMenuBar                        (void)                                                        ONEWORDINLINE(0xA93B);
  393.  
  394. EXTERN_API( void )
  395. SetMenuBar                        (Handle                 menuList)                            ONEWORDINLINE(0xA93C);
  396.  
  397. EXTERN_API( Boolean )
  398. SystemEdit                        (short                     editCmd)                            ONEWORDINLINE(0xA9C2);
  399.  
  400. EXTERN_API( void )
  401. SystemMenu                        (long                     menuResult)                            ONEWORDINLINE(0xA9B5);
  402.  
  403. EXTERN_API( Handle )
  404. GetNewMBar                        (short                     menuBarID)                            ONEWORDINLINE(0xA9C0);
  405.  
  406. EXTERN_API( void )
  407. ClearMenuBar                    (void)                                                        ONEWORDINLINE(0xA934);
  408.  
  409. EXTERN_API( void )
  410. CheckItem                        (MenuHandle             theMenu,
  411.                                  short                     item,
  412.                                  Boolean                 checked)                            ONEWORDINLINE(0xA945);
  413.  
  414. EXTERN_API( short )
  415. CountMItems                        (MenuHandle             theMenu)                            ONEWORDINLINE(0xA950);
  416.  
  417. EXTERN_API( void )
  418. SetMenuFlash                    (short                     count)                                ONEWORDINLINE(0xA94A);
  419.  
  420. EXTERN_API( long )
  421. MenuSelect                        (Point                     startPt)                            ONEWORDINLINE(0xA93D);
  422.  
  423. EXTERN_API( void )
  424. InsertFontResMenu                (MenuHandle             theMenu,
  425.                                  short                     afterItem,
  426.                                  short                     scriptFilter)                        THREEWORDINLINE(0x303C, 0x0400, 0xA825);
  427.  
  428. EXTERN_API( void )
  429. InsertIntlResMenu                (MenuHandle             theMenu,
  430.                                  ResType                 theType,
  431.                                  short                     afterItem,
  432.                                  short                     scriptFilter)                        THREEWORDINLINE(0x303C, 0x0601, 0xA825);
  433.  
  434.  
  435. /*——————————————————————————————————————————————————————————————————————————————————————*/
  436. /*    • Appearance 1.0 and later Menu Manager routines                                    */
  437. /*——————————————————————————————————————————————————————————————————————————————————————*/
  438. EXTERN_API( UInt32 )
  439. MenuEvent                        (const EventRecord *    inEvent)                            THREEWORDINLINE(0x303C, 0x020C, 0xA825);
  440.  
  441. EXTERN_API( OSErr )
  442. SetMenuItemCommandID            (MenuHandle             inMenu,
  443.                                  SInt16                 inItem,
  444.                                  UInt32                 inCommandID)                        THREEWORDINLINE(0x303C, 0x0502, 0xA825);
  445.  
  446. EXTERN_API( OSErr )
  447. GetMenuItemCommandID            (MenuHandle             inMenu,
  448.                                  SInt16                 inItem,
  449.                                  UInt32 *                outCommandID)                        THREEWORDINLINE(0x303C, 0x0503, 0xA825);
  450.  
  451. EXTERN_API( OSErr )
  452. SetMenuItemModifiers            (MenuHandle             inMenu,
  453.                                  SInt16                 inItem,
  454.                                  UInt8                     inModifiers)                        THREEWORDINLINE(0x303C, 0x0404, 0xA825);
  455.  
  456. EXTERN_API( OSErr )
  457. GetMenuItemModifiers            (MenuHandle             inMenu,
  458.                                  SInt16                 inItem,
  459.                                  UInt8 *                outModifiers)                        THREEWORDINLINE(0x303C, 0x0505, 0xA825);
  460.  
  461. EXTERN_API( OSErr )
  462. SetMenuItemIconHandle            (MenuHandle             inMenu,
  463.                                  SInt16                 inItem,
  464.                                  UInt8                     inIconType,
  465.                                  Handle                 inIconHandle)                        THREEWORDINLINE(0x303C, 0x0606, 0xA825);
  466.  
  467. EXTERN_API( OSErr )
  468. GetMenuItemIconHandle            (MenuHandle             inMenu,
  469.                                  SInt16                 inItem,
  470.                                  UInt8 *                outIconType,
  471.                                  Handle *                outIconHandle)                        THREEWORDINLINE(0x303C, 0x0707, 0xA825);
  472.  
  473. EXTERN_API( OSErr )
  474. SetMenuItemTextEncoding            (MenuHandle             inMenu,
  475.                                  SInt16                 inItem,
  476.                                  TextEncoding             inScriptID)                            THREEWORDINLINE(0x303C, 0x0408, 0xA825);
  477.  
  478. EXTERN_API( OSErr )
  479. GetMenuItemTextEncoding            (MenuHandle             inMenu,
  480.                                  SInt16                 inItem,
  481.                                  TextEncoding *            outScriptID)                        THREEWORDINLINE(0x303C, 0x0509, 0xA825);
  482.  
  483. EXTERN_API( OSErr )
  484. SetMenuItemHierarchicalID        (MenuHandle             inMenu,
  485.                                  SInt16                 inItem,
  486.                                  SInt16                 inHierID)                            THREEWORDINLINE(0x303C, 0x040D, 0xA825);
  487.  
  488. EXTERN_API( OSErr )
  489. GetMenuItemHierarchicalID        (MenuHandle             inMenu,
  490.                                  SInt16                 inItem,
  491.                                  SInt16 *                outHierID)                            THREEWORDINLINE(0x303C, 0x050E, 0xA825);
  492.  
  493. EXTERN_API( OSErr )
  494. SetMenuItemFontID                (MenuHandle             inMenu,
  495.                                  SInt16                 inItem,
  496.                                  SInt16                 inFontID)                            THREEWORDINLINE(0x303C, 0x040F, 0xA825);
  497.  
  498. EXTERN_API( OSErr )
  499. GetMenuItemFontID                (MenuHandle             inMenu,
  500.                                  SInt16                 inItem,
  501.                                  SInt16 *                outFontID)                            THREEWORDINLINE(0x303C, 0x0510, 0xA825);
  502.  
  503. EXTERN_API( OSErr )
  504. SetMenuItemRefCon                (MenuHandle             inMenu,
  505.                                  SInt16                 inItem,
  506.                                  UInt32                 inRefCon)                            THREEWORDINLINE(0x303C, 0x050A, 0xA825);
  507.  
  508. EXTERN_API( OSErr )
  509. GetMenuItemRefCon                (MenuHandle             inMenu,
  510.                                  SInt16                 inItem,
  511.                                  UInt32 *                outRefCon)                            THREEWORDINLINE(0x303C, 0x050B, 0xA825);
  512.  
  513. EXTERN_API( OSErr )
  514. SetMenuItemRefCon2                (MenuHandle             inMenu,
  515.                                  SInt16                 inItem,
  516.                                  UInt32                 inRefCon2)                            THREEWORDINLINE(0x303C, 0x0511, 0xA825);
  517.  
  518. EXTERN_API( OSErr )
  519. GetMenuItemRefCon2                (MenuHandle             inMenu,
  520.                                  SInt16                 inItem,
  521.                                  UInt32 *                outRefCon2)                            THREEWORDINLINE(0x303C, 0x0512, 0xA825);
  522.  
  523. EXTERN_API( OSErr )
  524. SetMenuItemKeyGlyph                (MenuHandle             inMenu,
  525.                                  SInt16                 inItem,
  526.                                  SInt16                 inGlyph)                            THREEWORDINLINE(0x303C, 0x0513, 0xA825);
  527.  
  528. EXTERN_API( OSErr )
  529. GetMenuItemKeyGlyph                (MenuHandle             inMenu,
  530.                                  SInt16                 inItem,
  531.                                  SInt16 *                outGlyph)                            THREEWORDINLINE(0x303C, 0x0514, 0xA825);
  532.  
  533. /*——————————————————————————————————————————————————————————————————————————————————————*/
  534. /*    • Contextual Menu routines and constants                                            */
  535. /*    available with Conxtextual Menu extension 1.0 and later                                */
  536. /*——————————————————————————————————————————————————————————————————————————————————————*/
  537. /* Gestalt Selector for classic 68K apps only. */
  538. /* CFM apps should weak link and check the symbols. */
  539.  
  540. enum {
  541.     gestaltContextualMenuAttr    = FOUR_CHAR_CODE('cmnu'),
  542.     gestaltContextualMenuUnusedBit = 0,
  543.     gestaltContextualMenuTrapAvailable = 1
  544. };
  545.  
  546. /* Values indicating what kind of help the application supports */
  547.  
  548. enum {
  549.     kCMHelpItemNoHelp            = 0,
  550.     kCMHelpItemAppleGuide        = 1,
  551.     kCMHelpItemOtherHelp        = 2
  552. };
  553.  
  554. /* Values indicating what was chosen from the menu */
  555.  
  556. enum {
  557.     kCMNothingSelected            = 0,
  558.     kCMMenuItemSelected            = 1,
  559.     kCMShowHelpSelected            = 3
  560. };
  561.  
  562. EXTERN_API( OSStatus )
  563. InitContextualMenus                (void)                                                        TWOWORDINLINE(0x7001, 0xAA72);
  564.  
  565. EXTERN_API( Boolean )
  566. IsShowContextualMenuClick        (const EventRecord *    inEvent)                            TWOWORDINLINE(0x7002, 0xAA72);
  567.  
  568. EXTERN_API( OSStatus )
  569. ContextualMenuSelect            (MenuHandle             inMenu,
  570.                                  Point                     inGlobalLocation,
  571.                                  Boolean                 inReserved,
  572.                                  UInt32                 inHelpType,
  573.                                  ConstStr255Param         inHelpItemString,
  574.                                  const AEDesc *            inSelection,
  575.                                  UInt32 *                outUserSelectionType,
  576.                                  SInt16 *                outMenuID,
  577.                                  UInt16 *                outMenuItem)                        TWOWORDINLINE(0x7003, 0xAA72);
  578.  
  579. EXTERN_API( Boolean )
  580. ProcessIsContextualMenuClient    (ProcessSerialNumber *    inPSN)                                TWOWORDINLINE(0x7004, 0xAA72);
  581.  
  582.  
  583.  
  584.  
  585. /* 
  586.     CheckItem, CountMItems, and SetMenuFlash should have better names.
  587.     But the shipping InterfaceLib has the old names, so we need
  588.     to define the new and old names and use macros to map the 
  589.     new names to old names for linking with InterfaceLib.
  590. */
  591. #if TARGET_OS_MAC
  592.     #define CheckMenuItem MacCheckMenuItem
  593. #endif
  594. #define MacCheckMenuItem( menu, item, checked ) CheckItem( menu, item, checked )
  595. #define CountMenuItems( menu )                     CountMItems( menu )
  596. #define SetMenuFlashCount( count )                 SetMenuFlash( count )
  597.  
  598.  
  599. #if CGLUESUPPORTED
  600. EXTERN_API_C( MenuHandle )
  601. newmenu                            (short                     menuID,
  602.                                  const char *            menuTitle);
  603.  
  604. EXTERN_API_C( void )
  605. appendmenu                        (MenuHandle             menu,
  606.                                  const char *            data);
  607.  
  608. EXTERN_API_C( void )
  609. insertmenuitem                    (MenuHandle             theMenu,
  610.                                  const char *            itemString,
  611.                                  short                     afterItem);
  612.  
  613. EXTERN_API_C( long )
  614. menuselect                        (const Point *            startPt);
  615.  
  616. EXTERN_API_C( void )
  617. setmenuitemtext                    (MenuHandle             menu,
  618.                                  short                     item,
  619.                                  const char *            itemString);
  620.  
  621. EXTERN_API_C( void )
  622. getmenuitemtext                    (MenuHandle             menu,
  623.                                  short                     item,
  624.                                  char *                    itemString);
  625.  
  626. #endif  /* CGLUESUPPORTED */
  627.  
  628. #if OLDROUTINENAMES
  629. #define AddResMenu(theMenu, theType) AppendResMenu(theMenu, theType)
  630. #define InsMenuItem(theMenu, itemString, afterItem)    InsertMenuItem(theMenu, itemString, afterItem)
  631. #define DelMenuItem( theMenu, item ) DeleteMenuItem( theMenu, item )
  632. #if TARGET_OS_MAC
  633. #define SetItem MacSetItem
  634. #define GetItem MacGetItem
  635. #endif
  636. #define MacSetItem(theMenu, item, itemString) SetMenuItemText(theMenu, item, itemString)
  637. #define MacGetItem(theMenu, item, itemString) GetMenuItemText(theMenu, item, itemString)
  638. #define GetMHandle(menuID) GetMenuHandle(menuID)
  639. #define DelMCEntries(menuID, menuItem) DeleteMCEntries(menuID, menuItem)
  640. #define DispMCInfo(menuCTbl) DisposeMCInfo(menuCTbl)
  641. #if CGLUESUPPORTED
  642. #define addresmenu(menu, data) appendresmenu(menu, data)
  643. #define getitem(menu, item, itemString) getmenuitemtext(menu, item, itemString)
  644. #define setitem(menu, item, itemString) setmenuitemtext(menu, item, itemString)
  645. #define insmenuitem(theMenu, itemString, afterItem)    insertmenuitem(theMenu, itemString, afterItem)
  646. #endif    /* CGLUESUPPORTED */
  647. #endif  /* OLDROUTINENAMES */
  648.  
  649.  
  650.  
  651. #if TARGET_OS_WIN32
  652. #endif  /* TARGET_OS_WIN32 */
  653.  
  654.  
  655. #if PRAGMA_STRUCT_ALIGN
  656.     #pragma options align=reset
  657. #elif PRAGMA_STRUCT_PACKPUSH
  658.     #pragma pack(pop)
  659. #elif PRAGMA_STRUCT_PACK
  660.     #pragma pack()
  661. #endif
  662.  
  663. #ifdef PRAGMA_IMPORT_OFF
  664. #pragma import off
  665. #elif PRAGMA_IMPORT
  666. #pragma import reset
  667. #endif
  668.  
  669. #ifdef __cplusplus
  670. }
  671. #endif
  672.  
  673. #endif /* __MENUS__ */
  674.  
  675.